//类方法

public class demo3_1_private
{
    //变量
 private int sum1;
 private int sum2;
    //set,get方法
public void setSum1(int a){
    if(a>0){
        System.out.println("sum1必须小于0");
    }else{sum1=a;
    System.out.println("sum1的值设置完成");
}
}
public void setSum2(int a){
    if(a<0){
        System.out.println("sum2必须大于0");
    }else{sum2=a;
    System.out.println("sum2的值设置完成");
}
}
public int getSum1(){
return sum1;
}
public int getSum2(){
return sum2;
}      
    
/* //注释掉之前的方法
public void suChu(){
    System.out.println("sum1的值为"+sum1);
    System.out.println("sum2的值为"+sum2);
}
public int jiaFa(int a,int b){
    int c=a+b;
    System.out.println("加法结果为"+c);
    return c;
}
public int chengFa(int a,int b){
    int c=a*b;
    System.out.println("乘法结果为"+c);
    return c;
}  
*/
   
}    


 
    
